<template>
  <tr :id="index">
    <td><input type="checkbox" v-model="goodList.checked" /></td>
    <td>{{ uname }}</td>
    <td>{{ price }}</td>
    <td>
      <button @click="reduce">-</button>
      {{ num }}
      <button @click="add">+</button>
    </td>
    <td>{{ price * num }}</td>
    <td><button @click="del">删除</button></td>
  </tr>
</template>

<script>
export default {
  data() {
    return {}
  },
  props: ['uname', 'price', 'num', 'checked', 'goodList', 'index', 'goodListArr'],
  methods: {
    reduce() {
      this.$emit('reduce', this.index)
    },
    add() {
      this.$emit('add', this.index)
    },
    del() {
      this.goodListArr.splice(this.index, 1)
    }
  }
}
</script>

<style lang="scss"></style>
